package com.siwei.mes.mapper.experiment;

import com.siwei.mes.common.base.BaseMapper;
import com.siwei.mes.entity.dto.ExperimentDetailDto;
import com.siwei.mes.entity.experiment.ExperimentDetail;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 试验台账json详情(ExperimentDetail)表数据库访问层
 *
 * @author linzi
 * @since 2023-12-27 23:30:46
 */
public interface ExperimentDetailMapper extends BaseMapper<ExperimentDetail> {
    /**
     * 获取所有
     *
     * @param entity
     * @return
     */
    List<ExperimentDetail> getList(ExperimentDetail entity);

    /**
     * 根据id获取
     *
     * @param id
     * @return
     */
    ExperimentDetail loadById(@Param("id") Long id);

    /**
     * 根据试验台账id查询
     *
     * @param experimentId 试验台账id
     * @return
     */
    List<ExperimentDetail> selectByExperimentId(@Param("experimentId") Long experimentId, @Param("testProjectCode") String testProjectCode);

    /**
     * 查询对应试验项目code的试验委托id
     *
     * @param frwd            任务单号
     * @param checkType       1-快检 2-批检
     * @param testProjectCode 试验项目code
     * @return
     */
    List<Long> selectExperimentIdByTestProjectCode(@Param("frwd") Integer frwd, @Param("checkType") Integer checkType, @Param("testProjectCode") String testProjectCode);

    /**
     * 查询对应试验项目code的试验样品编号
     *
     * @param frwd            任务单号
     * @param checkType       1-快检 2-批检
     * @param testProjectCode 试验项目code
     * @return
     */
    List<String> selectSampleIdByTestProjectCode(@Param("frwd") Integer frwd, @Param("checkType") Integer checkType, @Param("testProjectCode") String testProjectCode);

    /**
     * 查询对应试验项目code的试验委托id
     *
     * @param testProjectCode 试验项目code
     * @param fPhbNo 配合比
     * @param fGcmc 工程名称
     * @param year 年份
     * @return
     */
    List<Long> selectExperimentIdByTestProjectCodeRwd(@Param("testProjectCode") String testProjectCode,@Param("fPhbNo") String fPhbNo, @Param("fGcmc") String fGcmc, @Param("year") String year);


    List<Long> selectExperimentIdByTestProjectCodeRwdUpdate(ExperimentDetailDto experimentDetailDto);

    /**
     * 根据试验委托id删除
     *
     * @param experimentId
     */
    void deleteByExperimentId(@Param("experimentId") Long experimentId);
}
